/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  
<<<<<<< HEAD
  // 默认首页
  router.get('/', controller.home.index);
  
=======
  // 请求日志中间件
  app.use(async (ctx, next) => {
    console.log(`收到请求: ${ctx.method} ${ctx.path}`);
    console.log('请求参数:', ctx.request.body);
    await next();
    console.log('响应结果:', ctx.body);
  });

  // 默认首页
  router.get('/', controller.home.index);
  
  // ========== 账户相关路由 ==========
  
>>>>>>> resume
  // 账户相关路由
  router.post('/api/accounts/register', controller.account.register);  // 用户注册
  router.post('/api/accounts/login', controller.account.login);        // 用户登录
  router.put('/api/accounts/logout', controller.account.logout);       // 用户登出
  
<<<<<<< HEAD
=======
  // 用户管理路由（系统管理员）
  router.get('/api/accounts/users', controller.account.getUsers);         // 获取用户列表
  router.get('/api/accounts/users/:id', controller.account.getUser);     // 获取用户详情
  router.post('/api/accounts/users', controller.account.createUser);     // 创建用户
  router.put('/api/accounts/users/:id', controller.account.updateUser);  // 更新用户
  router.delete('/api/accounts/users/:id', controller.account.deleteUser); // 删除用户
  
  // ========== 简历功能路由 ==========
  
>>>>>>> resume
  // 模板相关路由
  router.post('/api/templates', controller.resumeTemplate.create);           // 创建模板
  router.post('/api/templates/batch', controller.resumeTemplate.batchImport); // 批量导入模板
  router.get('/api/templates', controller.resumeTemplate.index);             // 获取模板列表
  router.get('/api/templates/:id', controller.resumeTemplate.show);          // 获取模板详情
  
  // 简历相关路由
  router.post('/api/resumes', controller.resume.create);       // 创建简历
  router.get('/api/resumes', controller.resume.index);         // 获取简历列表
<<<<<<< HEAD
  router.get('/api/resumes/:id', controller.resume.show);      // 获取简历详情
  router.put('/api/resumes/:id', controller.resume.update);    // 更新简历
  router.delete('/api/resumes/:id', controller.resume.destroy); // 删除简历
=======
  router.get('/api/resumes/shared', controller.resume.shared); // 获取分享的简历列表
  router.get('/api/resumes/:id', controller.resume.show);      // 获取简历详情
  router.put('/api/resumes/:id', controller.resume.update);    // 更新简历
  router.delete('/api/resumes/:id', controller.resume.destroy); // 删除简历
  router.post('/api/resumes/:id/share', controller.resume.share);   // 分享简历
  router.post('/api/resumes/:id/unshare', controller.resume.unshare); // 取消分享简历
>>>>>>> resume
  
  // PDF简历相关路由
  router.post('/api/pdf-resumes/upload', controller.pdfResume.upload);    // 上传PDF简历
  router.get('/api/pdf-resumes', controller.pdfResume.index);             // 获取PDF简历列表
  router.get('/api/pdf-resumes/:id', controller.pdfResume.show);          // 获取PDF简历详情
  router.delete('/api/pdf-resumes/:id', controller.pdfResume.destroy);    // 删除PDF简历
  
  // 收藏相关路由
<<<<<<< HEAD
  router.get('/api/favorites', controller.favorite.index);        // 获取收藏列表
  router.post('/api/favorites', controller.favorite.create);      // 添加收藏
  router.delete('/api/favorites/:jobId', controller.favorite.destroy); // 取消收藏
  router.get('/api/favorites/check', controller.favorite.check);  // 检查是否已收藏
};
=======
  router.post('/api/favorites', controller.resumeFavorite.create);        // 收藏简历
  router.get('/api/favorites', controller.resumeFavorite.index);          // 获取收藏列表
  router.get('/api/favorites/check', controller.resumeFavorite.check);    // 检查是否已收藏
  router.delete('/api/favorites/:id', controller.resumeFavorite.destroy); // 取消收藏
  
  // ========== 求职功能路由 ==========
  
  // 企业相关路由
  router.get('/api/enterprises', controller.job1.enterprise.getEnterpriseList);
  router.post('/api/enterprises', controller.job1.enterprise.createEnterprise);
  router.get('/api/enterprises/:enterpriseId', controller.job1.enterprise.getEnterpriseInfo);
  router.put('/api/enterprises/:enterpriseId', controller.job1.enterprise.updateEnterpriseInfo);
  router.delete('/api/enterprises/:enterpriseId', controller.job1.enterprise.deleteEnterprise);
  router.post('/api/enterprises/:enterpriseId/upload-image', controller.job1.enterprise.uploadEnterpriseImage);
  router.get('/api/enterprises/:enterpriseId/statistics', controller.job1.enterprise.getEnterpriseStatistics);
  router.get('/api/enterprises/:enterpriseId/reviews', controller.job1.enterprise.getEnterpriseReviews);
  router.post('/api/reviews/:reviewId/reply', controller.job1.enterprise.replyEnterpriseReview);
  router.post('/api/complaints/:complaintId/process', controller.job1.enterprise.processEnterpriseComplaint);
  
  // 岗位相关路由
  router.get('/api/jobs', controller.job1.job.getJobList);
  router.get('/api/jobs/:jobId', controller.job1.job.getJobDetail);
  router.post('/api/jobs', controller.job1.job.createJob);
  router.put('/api/jobs/:jobId', controller.job1.job.updateJob);
  router.delete('/api/jobs/:jobId', controller.job1.job.deleteJob);
  router.put('/api/jobs/:jobId/status', controller.job1.job.updateJobStatus);
  router.put('/api/jobs/:jobId/top', controller.job1.job.updateJobTopStatus);
  router.get('/api/jobs/:jobId/applications', controller.job1.job.getJobApplicationData);
  router.post('/api/jobs/:jobId/apply', controller.job1.job.applyJob);
  router.post('/api/jobs/:jobId/collect', controller.job1.job.collectJob);
  router.delete('/api/jobs/:jobId/collect', controller.job1.job.uncollectJob);
  router.get('/api/jobs/:jobId/check-collected', controller.job1.job.checkJobCollected);
  router.get('/api/user/favorite-jobs', controller.job1.job.getUserFavoriteJobs);
  router.get('/api/user/applications', controller.job1.job.getUserApplications);
  router.get('/api/applications/all', controller.job1.job.getAllApplications); // 获取所有投递记录（管理员）
  router.get('/api/enterprises/:enterpriseId/applications', controller.job1.job.getEnterpriseApplications);
  router.put('/api/applications/:applicationId/status', controller.job1.job.updateApplicationStatus);
  router.delete('/api/applications/:applicationId', controller.job1.job.withdrawApplication);
  router.post('/api/jobs/batch', controller.job1.job.batchOperateJobs);
  
  // 概览统计
  router.get('/api/statistics/overview', controller.statistics.overview);
  
  // 评价相关路由
  router.post('/api/reviews', controller.job1.review.createReview);
  router.get('/api/enterprises/:enterpriseId/reviews', controller.job1.review.getEnterpriseReviews);
  router.put('/api/reviews/:reviewId/reply', controller.job1.review.replyReview);
  router.delete('/api/reviews/:reviewId', controller.job1.review.deleteReview);
  router.post('/api/reviews/:reviewId/report', controller.job1.review.reportReview);
  router.post('/api/complaints/:complaintId/process', controller.job1.review.processComplaint);
  router.get('/api/complaints', controller.job1.review.getComplaints);
  
  // 员工相关路由
  router.get('/api/employees/all', controller.job1.employee.getAllEmployees); // 获取所有员工（管理员）
  router.get('/api/enterprises/:enterpriseId/employees', controller.job1.employee.getEnterpriseEmployees);
  router.post('/api/employees', controller.job1.employee.createEmployee);
  router.put('/api/employees/:employeeId', controller.job1.employee.updateEmployee);
  router.delete('/api/employees/:employeeId', controller.job1.employee.deleteEmployee);
  router.post('/api/employees/batch', controller.job1.employee.batchOperateEmployees);
  
  // ========== 面试功能路由 ==========
  
  // 题目分类相关路由
  router.get('/api/question-category', controller.questionCategory.index);      // 获取分类列表
  router.get('/api/question-category/:id', controller.questionCategory.show); // 获取分类详情
  router.post('/api/question-category', controller.questionCategory.create);  // 创建分类
  router.put('/api/question-category/:id', controller.questionCategory.update); // 更新分类
  router.delete('/api/question-category/:id', controller.questionCategory.destroy); // 删除分类
  
  // 题目相关路由
  router.get('/api/question', controller.question.index);      // 获取题目列表
  router.get('/api/question/:id', controller.question.show);   // 获取题目详情
  router.post('/api/question', controller.question.create);    // 创建题目
  router.put('/api/question/:id', controller.question.update); // 更新题目
  router.delete('/api/question/:id', controller.question.destroy); // 删除题目
  
  // 题目答案相关路由
  router.get('/api/question-answer', controller.questionAnswer.index);      // 获取答案列表
  router.get('/api/question-answer/:id', controller.questionAnswer.show);   // 获取答案详情
  router.post('/api/question-answer', controller.questionAnswer.create);     // 创建答案
  router.put('/api/question-answer/:id', controller.questionAnswer.update); // 更新答案
  router.delete('/api/question-answer/:id', controller.questionAnswer.destroy); // 删除答案
  
  // 面试经验相关路由
  router.get('/api/interview-experience', controller.interviewExperience.index);      // 获取经验列表
  router.get('/api/interview-experience/:id', controller.interviewExperience.show);   // 获取经验详情
  router.post('/api/interview-experience', controller.interviewExperience.create);     // 创建经验
  router.delete('/api/interview-experience/:id', controller.interviewExperience.destroy); // 删除经验
  
  // 面试日程相关路由
  router.get('/api/interview-schedule', controller.interviewSchedule.index);      // 获取日程列表
  router.get('/api/interview-schedule/:id', controller.interviewSchedule.show);   // 获取日程详情
  router.post('/api/interview-schedule', controller.interviewSchedule.create);     // 创建日程
  router.put('/api/interview-schedule/:id', controller.interviewSchedule.update); // 更新日程
  router.delete('/api/interview-schedule/:id', controller.interviewSchedule.destroy); // 删除日程
  
  // 面试结果相关路由
  router.get('/api/interview-result', controller.interviewResult.index);      // 获取结果列表
  router.get('/api/interview-result/:id', controller.interviewResult.show);   // 获取结果详情
  router.post('/api/interview-result', controller.interviewResult.create);     // 创建结果
  router.put('/api/interview-result/:id', controller.interviewResult.update); // 更新结果
  router.delete('/api/interview-result/:id', controller.interviewResult.destroy); // 删除结果
  
  // 简历处理相关路由
  router.get('/api/resume-processing', controller.resumeProcessing.index);      // 获取处理列表
  router.get('/api/resume-processing/:id', controller.resumeProcessing.show);   // 获取处理详情
  router.post('/api/resume-processing', controller.resumeProcessing.create);     // 创建处理记录
  router.put('/api/resume-processing/:id', controller.resumeProcessing.update); // 更新处理记录
  router.delete('/api/resume-processing/:id', controller.resumeProcessing.destroy); // 删除处理记录
  
  // 经验评论相关路由
  router.get('/api/experience-comment', controller.experienceComment.index);      // 获取评论列表
  router.post('/api/experience-comment', controller.experienceComment.create);     // 创建评论
};
>>>>>>> resume
